package ComparableAndComparator;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import java.util.TreeSet;

public class Listas {
	public static void main(String argv[]){
		String[] sa = {"one", "two", "three", "four"};
		List sList = Arrays.asList(sa); // make a List
		System.out.println("size " + sList.size());
		System.out.println("idx2 " + sList.get(2));
		sList.set(3,"six"); // change List
		sa[1] = "five";
		for(String s:sa){
			System.out.print(s+" ");
		}
		for(Object b : sList){
			System.out.print(b+"-");
		}
	}

}


class Dog {
public String name;
Dog(String n) { name = n; }
}


class ItTest {
	public static void main(String[] args) {
		List<Dog> d = new ArrayList<Dog>();
		Dog dog = new Dog("aiko");
		d.add(dog);
		d.add(new Dog("clover"));
		d.add(new Dog("magnolia"));
		Iterator<Dog> i3 = d.iterator(); // make an iterator
		while (i3.hasNext()) {
			Dog d2 = i3.next(); // cast not required
			System.out.println(d2.name);
		}
		System.out.println("size " + d.size());
		System.out.println("get1 " + d.get(1).name);
		System.out.println("aiko " + d.indexOf(dog));
		
		d.remove(2);
		Object[] oa = d.toArray();
		
		for(Object o : oa) {
			Dog d2 = (Dog)o;
			System.out.println("oa " + d2.name);
		}
		
	}
}
class Setes {
	public static void main(String...argv){
		//Set s = new HashSet();
		Set s = new TreeSet();
		boolean[] ba = new boolean[5];
		// insert code here
		ba[0] = s.add(new Employee(1, "Jorge", 19));
		ba[1] = s.add(new Employee(5, "Frank", 28));
		ba[2]= s.add(new Employee(6, "Bill", 34));
		ba[3]= s.add(new Employee(3, "Michel", 10));
		ba[4]= s.add(new Employee(7, "Simpson", 8));
		
		for(int x=0; x<ba.length; x++)
			System.out.print(ba[x] + " ");
			System.out.println("\n");
			for(Object o : s)
			System.out.print(o + " ");
	}
}
